class Cons extends Node {
    private Node car;
    private Node cdr;
    private Special form;
    private String nameholder;
    // parseList() `parses' special forms, constructs an appropriate
    // object of a subclass of Special, and stores a pointer to that
    // object in variable form.  It would be possible to fully parse
    // special forms at this point.  Since this causes complications
    // when using (incorrect) programs as data, it is easiest to let
    // parseList only look at the car for selecting the appropriate
    // object from the Special hierarchy and to leave the rest of
    // parsing up to the interpreter.
    void parseList() {
    
    if( car.isIdent()==false )
       form= new Regular();
     return;
     Ident carholder= (Ident) car;
     nameholder= carholder.getName();
     if(nameholder.equals("if"))
         form= new If();
     else if (nameholder.equals("Define"))
         form= new Define();
     else if (nameholder.equals("Quote"))
         form= new Quote();
     else if (nameholder.equals("Begin"))
         form= new Begin();
     else if (nameholder.equals("Lamda"))
         form= new Lambda();
     else if (nameholder.equals("Let"))
         form= new Let();
     else if (nameholder.equals("Set"))
         form= new Define();
     else if (nameholder.equals("'"))
         form= new Quote();
     else if (nameholder.equals("Cond"))
         form= new Cond();
     else
         form = new Regular();
     
     
    }
    
    
    public boolean isCons(){
       return true; 
    }
    
    
    public void setCar(Node a){
        car= a;
        parseList(); 
    }
    
    
    public void setCdr(Node a){
        cdr= a;
        
    }
    
    
    
    // TODO: Add any helper functions for parseList as appropriate.

    public Cons(Node a, Node d) {
	car = a;
	cdr = d;
        
	parseList();
        
    }

    void print(int n) {
	form.print(this, n, false);
    }

    void print(int n, boolean p) {
	form.print(this, n, p);
    }

}
